package Euler429;

import java.util.*;

import ReusableCode.MathFunctions;
import ReusableCode.PrimeFunctions;

public class SumSquaresUnitaryDivisors {
	public static void main(String[] args) {
		int max = 17;
		
		for(int j = 2; j <= max; j++)
		{
			List<long[]> pairs = MathFunctions.getDivisorPairs(MathFunctions.getFactorial(j));
			System.out.print(j + " is ");
			for(int i = 0; i < pairs.size(); i++)
			{
				long pair[] = pairs.get(i);
				System.out.print("[" + pair[0] + ", " + pair[1] + "] ");
			}
			
			System.out.println();
		}
		
		System.out.println(/*"Working..."*/);
		
		for(int j = 2; j <= max; j++)
		{
			long n = MathFunctions.getFactorial(j);
			List<long[]> pairs = MathFunctions.getDivisorPairs(n);
			List<Long> unitary = new ArrayList<Long>();
			
			for(int i = 0; i < pairs.size(); i++)
			{
				long pair[] = pairs.get(i);
				long d = pair[0];
				
				if(MathFunctions.GCD(d, n/d) == 1)
				{
					unitary.add(pair[0]);
					unitary.add(pair[1]);
				}
				
				//System.out.print("[" + pair[0] + ", " + pair[1] + "] ");
			}
			
			System.out.println(j + " is " /*+ unitary*/ + " : " + unitary.size());
		}
		
		for(int j = 2; j <= max; j++)
		{
			List<Integer> factors = PrimeFunctions.factorize(MathFunctions.getFactorial(j));
			
			System.out.println(j + " is "/* + factors */+ " : " + factors.size());
		}
	}
}
